package lambdasinaction.chap8.my;

import java.util.function.Consumer;

/**
 * TODO
 *
 * @author Fish
 * @since 0.0.1 2018/8/7 19:37
 */
public class MyOnlineBankingLambda {

  public static void main(String[] args) {
    new MyOnlineBankingLambda().processCustomer(1337, (Customer c) -> System.out.println("hello java 8"));
  }

  public void processCustomer(int id,Consumer<Customer> makeCustomerHappy) {
    Customer customer = Database.getCustomerWithId(id);
    makeCustomerHappy.accept(customer);
  }

  // dummy Customer class
  static private class Customer{}

  // dummy Database class
  static private class Database{
    static Customer getCustomerWithId(int id) {
      return new Customer();
    }
  }

}
